export const shortcuts = [
  {
    text: '今日',
    value () {
      const end = new Date()
      const start = new Date()
      end.setTime(start.getTime())
      return [start, end]
    }
  },
  {
    text: '昨日',
    value () {
      const end = new Date()
      const start = new Date()
      start.setTime(start.getTime() - 3600 * 1000 * 24)
      end.setTime(end.getTime() - 3600 * 1000 * 24)
      return [start, end]
    }
  },
  {
    text: '本周',
    value () {
      const now = new Date() // 当前日期
      const nowDayOfWeek = now.getDay() // 今天本周的第几天
      const nowDay = now.getDate() // 当前日
      const nowMonth = now.getMonth() // 当前月
      const day = nowDayOfWeek || 7
      const start = new Date(now.getFullYear(), nowMonth, nowDay + 1 - day)
      const end = new Date(now.getFullYear(), nowMonth, nowDay + 7 - day)
      start.setTime(start.getTime())
      end.setTime(end.getTime())
      return [start, end]
    }
  },
  {
    text: '本月',
    value () {
      const now = new Date() // 当前日期
      let nowYear = now.getYear() // 当前年
      nowYear += (nowYear < 2000) ? 1900 : 0
      const nowMonth = now.getMonth() // 当前月
      // 本月天数
      const monthStartDate = new Date(nowYear, nowMonth, 1)
      const monthEndDate = new Date(nowYear, nowMonth + 1, 1)
      const days = (monthEndDate - monthStartDate) / (1000 * 60 * 60 * 24)
      const start = new Date(nowYear, nowMonth, 1)
      const end = new Date(nowYear, nowMonth, days)
      start.setTime(start.getTime())
      end.setTime(end.getTime())
      return [start, end]
    }
  }
]
